var text;
//查询
recruitmentDetails()
function recruitmentDetails() {
    var shuju=""
    $.ajax({
        type: "POST",
        url: root.brandWebsite.query,
        cache: false,  //禁用缓存
        dataType: "json",
        contentType: "application/json",
        data: JSON.stringify({

        }),
        success: function (data) {
            shuju=data.data.data

        },
        error: function () {
            $.Huimodalalert('失败！',2000);
        }
    });
    $.ajax({
        type: "get",
        url: root.brandWebsite.proxyquery,
        cache: false,  //禁用缓存
        dataType: "json",
        data: {
            "websiteId":sessionStorage.getItem("recruitmentId"),
        },
        success: function (data) {
            $("#websiteId").val(sessionStorage.getItem("websiteName2"))
            ue.ready(function() {
                text = ue.setContent(data.data.introductionMsg);
            });
            $("#tdkTitle").val(data.data.tdkTitle)
            $("#tdkDesc").val(data.data.tdkDesc)
            $("#tdkKeyword").val(data.data.tdkKeyword)

        },
        error: function () {
            $.Huimodalalert('失败！',2000);
        }
    });
}

//保存
function preservation() {
    //获取副本框
    if($("#tdkTitle").val()==""||$("#tdkDesc").val()==""||$("#tdkKeyword").val()==""){
        $.Huimodalalert('请完善必填信息',2000);
        return false
    }
    ue.ready(function() {
        text = ue.getContent();
    });
    $.ajax({
        type: "POST",
        url: root.brandWebsite.proxysave,
        cache: false,  //禁用缓存
        dataType: "json",
        contentType: "application/json",
        data: JSON.stringify({
            "websiteId":sessionStorage.getItem("recruitmentId"),
            "introductionMsg": text,
            "tdkTitle": $("#tdkTitle").val(),
            "tdkDesc": $("#tdkDesc").val(),
            "tdkKeyword": $("#tdkKeyword").val(),
            "operatorUser":JSON.parse(decodeURIComponent(web.readCookie("loginData"))).user.name,
        }),
        success: function (data) {
            if(data.errorCode==0){
                layer.msg("保存成功",{icon: 6,time:2000},function () {
                    setTimeout(function () {
                        window.parent.recruitmentAgentsquerys();
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    })
                });
            }else {
                layer.msg(data.msg, {icon: 5,time:1000});
            }
        },
        error: function () {
            $.Huimodalalert('失败！',2000);
        }
    });
}